Fix typing violation in extract_fields()#888
Fix typing violation in extract_fields()#888ogenstad wants to merge 1 commit intoinfrahub-developfrom
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## infrahub-develop #888 +/- ##
====================================================
- Coverage 80.98% 80.96% -0.02%
====================================================
Files 120 120
Lines 10449 10451 +2
Branches 1562 1563 +1
====================================================
Hits 8462 8462
- Misses 1475 1476 +1
- Partials 512 513 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Why
Correct typing violations. - The inner loop iterates over node.selection_set.selections, which is typed as FrozenList[SelectionNode]. SelectionNode is a union of FieldNode | InlineFragmentNode | FragmentSpreadNode, but only FieldNode has a .name attribute — the other two don't. Without the guard, ty correctly flagged 4 unresolved-attribute errors on sub_node.name.value. The outer loop already had the correct isinstance(node, FieldNode) pattern; the inner loop was simply missing it.
What changed
Added if not isinstance(sub_node, FieldNode): continue at the top of the inner loop in extract_fields